Quick links

 Contents
 Questions
 Detective

Memory Numbers in the Detective Explained
 
Depending on your computer, you may be surprised at how low the memory numbers are in the Detective window. You may notice they do not account for all the memory consumed on your computer. Where is the rest? The answer is, unfortunately, somewhat technical. First, part of your computer's memory is immediately taken by Windows and never returned. The later versions of Windows consume more and more memory; this source has become significant in recent years. Second, part of your memory goes straight to the disk cache. You can read more about this in the Optimize page. Depending on your settings, this can be very significant as well.

The rest is the really technical part. Windows employs a special method called "dynamic linking" in storing and executing programs. Dynamic linking allows different programs which share an identical piece of code to store only one copy of that code in memory. It saves memory on your computer, and lets programs run faster. But this leads to some difficulty in measuring how much memory a program actually uses. It's easy to measure how much memory a program uses directly, but how should these shared pieces of code be treated?

There are two ways to count the shared code. You could just ignore them, or you could count them against every program that uses them. There are advantages and drawbacks to each method. If you ignore dynamically-linked code, you don't get a complete picture of how much memory the program is using. You will not see any memory consumed by the shared pieces. On the other hand, if you count all the shared pieces you will see a much exaggerated view of each program. Most of the shared code is deep within the system, so vital that it is shared by all programs. It's going to be in memory whether or not any particular program is running, so counting it against any program (or all programs) is very inaccurate.

For the Detective window, we have elected to ignore the shared pieces of code and just count the memory the program consumes itself. In practice, this yields the most accurate view of how much memory a program needs to run, and relatively how memory-intensive it is. There is one hidden complexity, though. Windows NT-based computers (Windows NT, 2000 and XP) don't let programs count only consumed memory--they count everything. So the Detective window on those computers will show larger numbers, which include all the shared pieces of code.